package web.userUI;

import java.util.List;

import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

import web.sharedUI.SessionBean;
import ejb.dto.ReservationDTO;
import ejb.reservationManagement.ReservationMgr;


@ManagedBean
@SessionScoped
public class ReservationBean {
	
	public ReservationBean() {
	}
	
	@EJB
	private ReservationMgr reservationMgr;
	
	private int reservationId;
	private ReservationDTO reservation;
	
	public List<ReservationDTO> getMyReservations() {
		return reservationMgr.getMyReservationsDTO();
	}
	
	public void loadData() {
		this.reservation = reservationMgr.getReservationDTO(reservationId);
		if(reservation == null) {
			SessionBean.notFound();
		}
	}

	public int getReservationId() {
		return reservationId;
	}

	public void setReservationId(int reservationId) {
		this.reservationId = reservationId;
	}

	public ReservationDTO getReservation() {
		return reservation;
	}

	public void setReservation(ReservationDTO reservation) {
		this.reservation = reservation;
	}

}
